<?php

namespace app\common\model;

use think\Model;

class MemberMessage extends Model
{

    protected $hidden=['member_id','message_id'];
    public function msg()
    {
        return $this->hasone(Message::class,'id','message_id');
    }

    public function member()
    {
        return $this->hasOne(Member::class,'id','member_id');
    }

    public static function message($member_id,$page)
    {

       return self::with(['msg'])
           ->where(['member_id'=>$member_id])
           ->order('id','desc')
           ->paginate(20,false,['page'=>$page]);
    }
}
